function varargout = DarisGui(varargin)
% DARISGUI MATLAB code for DarisGui.fig
%      DARISGUI, by itself, creates a new DARISGUI or raises the existing
%      singleton*.
%
%      H = DARISGUI returns the handle to a new DARISGUI or the handle to
%      the existing singleton*.
%
%      DARISGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DARISGUI.M with the given input arguments.
%
%      DARISGUI('Property','Value',...) creates a new DARISGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before DarisGui_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to DarisGui_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help DarisGui

% Last Modified by GUIDE v2.5 10-Jul-2012 10:07:01

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @DarisGui_OpeningFcn, ...
                   'gui_OutputFcn',  @DarisGui_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before DarisGui is made visible.
function DarisGui_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to DarisGui (see VARARGIN)

% Choose default command line output for DarisGui
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes DarisGui wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = DarisGui_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from listbox1


% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in popupProjIDs.
function popupProjIDs_Callback(hObject, eventdata, handles)
% hObject    handle to popupProjIDs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupProjIDs contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupProjIDs


% --- Executes during object creation, after setting all properties.
function popupProjIDs_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupProjIDs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.output = hObject;
contents = get(handles.cidedit,'String')
disp(['bash ./dls ' contents])
[status dlsoutput] = system (['bash ./dls ' contents] )
%set(handles.outputbox,'String',[output dlsoutput]);
listelem = regexp(dlsoutput, '\n', 'split')
%elem = 
set(handles.listbox1,'String',listelem)

% --- Executes on key press with focus on figure1 and none of its controls.
function figure1_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  structure with the following fields (see FIGURE)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function LogonTag_Callback(hObject, eventdata, handles)
% hObject    handle to LogonTag (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_4_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in logonbutton.
function logonbutton_Callback(hObject, eventdata, handles)
% hObject    handle to logonbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Choose default command line output for lb
handles.output = hObject;
contents = cellstr(get(handles.popupmenu1,'String'))
domain = contents{get(handles.popupmenu1,'Value')}  %cellstr(get(handles.popupmenu1,'String'))
contents = cellstr(get(handles.edit1,'String'))
password = logindlg('Password','only')   %{get(handles.edit1,'Value')}
%domain = 
disp(['bash ./dlogon ' domain])
[status output] = system (['echo "' password '" | bash ./dlogon ' domain])
if status ==0
        disp(output)
else
        disp('error in dlogon');
end
ProjIDs = GetProjIDs(handles);
set(handles.popupProjIDs,'String',ProjIDs)

function PIDs = GetProjIDs(handles)
[status dlsoutput] = system ('bash ./dls ')
%set(handles.outputbox,'String',[output dlsoutput]);
listelem =regexp(dlsoutput, '\n', 'split')
%set(handles.listbox1,'String',listelem)
elems = regexp(listelem,'(587.\w.\w)','match')
   % disp(elems)
%set(handles.dataset_table,'Data',elems)
%disp([cellstr(elems{1}) cellstr(elems{2})])
PIDs=[];
for i = 1:length(elems)
    if ~isempty(elems{i})
        PIDs=[PIDs cellstr(elems{i})];
    end
end

% --- Executes 
function outputbox_Callback(hObject, eventdata, handles)
% hObject    handle to outputbox (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of outputbox as text
%        str2double(get(hObject,'String')) returns contents of outputbox as a double


% --- Executes during object creation, after setting all properties.
function outputbox_CreateFcn(hObject, eventdata, handles)
% hObject    handle to outputbox (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on key press with focus on pushbutton1 and none of its controls.
function pushbutton1_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)




function cidedit_Callback(hObject, eventdata, handles)
% hObject    handle to cidedit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of cidedit as text
%        str2double(get(hObject,'String')) returns contents of cidedit as a double


% --- Executes during object creation, after setting all properties.
function cidedit_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cidedit (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on key press with focus on listbox1 and none of its controls.
function listbox1_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to listbox1 (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)
handles.output = hObject;
disp('Refreshing List')
contents = get(handles.listbox1,'String')
selected = contents{get(handles.listbox1,'Value')}
textsel = regexp(selected, '(587[^ ]* )', 'match')
%set(handles.cidedit,'String', textsel{4})
[status dlsoutput] = system (['bash ./dls ' textsel{:}] )
listelem = regexp(dlsoutput, '\n', 'split')
%elem = 
set(handles.listbox1,'String',listelem)


% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.output = hObject;
[status dlsoutput] = system ('bash ./dls -r 0')
%set(handles.outputbox,'String',[output dlsoutput]);
listelem =regexp(dlsoutput, '\n', 'split')
set(handles.listbox1,'String',listelem)
elems = regexp(listelem,'(587.2.1.[0-9]*.1.[0-9]*.[0-9]*)','match')
disp(iscell(elems))

       

% --- Executes on key press with focus on pushbutton3 and none of its controls.
function pushbutton3_KeyPressFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  structure with the following fields (see UICONTROL)
%	Key: name of the key that was pressed, in lower case
%	Character: character interpretation of the key(s) that was pressed
%	Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles    structure with handles and user data (see GUIDATA)


% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over popupProjIDs.
function popupProjIDs_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to popupProjIDs (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes when selected cell(s) is changed in dataset_table.
function dataset_table_CellSelectionCallback(hObject, eventdata, handles)
% hObject    handle to dataset_table (see GCBO)
% eventdata  structure with the following fields (see UITABLE)
%	Indices: row and column indices of the cell(s) currently selecteds
% handles    structure with handles and user data (see GUIDATA)
disp('Selecting Dataset List in Table')
% Obtain 1st column of current selection indices from event data;
% this contains row indices. We don't need column indices.
selection = eventdata.Indices(:,1);
% Remove duplicate row IDs
selection = unique(selection);
% Don't process less than a minimum nuber of observations
if size(selection) < 1
    return
end
% Obtain the data table
table = get(hObject,'Data');
% The selection is the table for stats and plot purposes;
% always extract both columns
% Cache the selection in case the plot type changes
handles.currSelection = selection;
guidata(hObject,handles)
%contents = get(handles.listbox1,'String')
%selected = contents{get(handles.listbox1,'Value')}
disp('Selected datasets:')
disp(selection)


function refreshDisplays(table, handles, item)
% Updates the statistics table and one of the plots.
% Called from several tablestat GUI callbacks.
%   table    The data to summarize (a population or selection)
%            it has only one column
%   handles  The handles structure
%   item     Which column and corresponsing plot to update

% Get the stats table from the gui
datasets = get(handles.data_sets, 'Data');
% Generate the stats for the selection
datasets = setDataSets(datasets);
% Replace the stats in the gui with the updated ones
set(handles.data_stats, 'Data', stats);

function datasets = setDataSets(datasets)
% Computes basic statistics for data table.
%   table  The data to summarize (a population or selection)
%   stats  Array of statistics to update
%   col    Which column of the array to update
%   peak   Value for the peak period, computed externally
[status dlsoutput] = system ('bash ./dls -r 0')
%set(handles.outputbox,'String',[output dlsoutput]);
listelem =regexp(dlsoutput, '\n', 'split')
set(handles.listbox1,'String',listelem)
elems = regexp(listelem,'(587.2.1.[0-9]*.1.[0-9]*.[0-9]*)','match');




% --- Executes on selection change in locallist.
function locallist_Callback(hObject, eventdata, handles)
% hObject    handle to locallist (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns locallist contents as cell array
%        contents{get(hObject,'Value')} returns selected item from locallist


% --- Executes during object creation, after setting all properties.
function locallist_CreateFcn(hObject, eventdata, handles)
% hObject    handle to locallist (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function CurrentDir_Callback(hObject, eventdata, handles)
% hObject    handle to CurrentDir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of CurrentDir as text
%        str2double(get(hObject,'String')) returns contents of CurrentDir as a double


% --- Executes during object creation, after setting all properties.
function CurrentDir_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CurrentDir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes when selected cell(s) is changed in dataset_table.
function dataset_table_CellSelectionCallback(hObject, eventdata, handles)
% hObject    handle to dataset_table (see GCBO)
% eventdata  structure with the following fields (see UITABLE)
%	Indices: row and column indices of the cell(s) currently selecteds
% handles    structure with handles and user data (see GUIDATA)
handles.output = hObject;
currentdir = pwd;
targetdir = uigetdir(currentdir,'Choose directory for storing data.')
SelectRow = eventdata(1,1);
CID = handles.dataset_table(SelectRow,1)
[status dlsoutput] = system (['bash ./dget -directory ' targetdir ' -cid ' CID])



% --- Executes on button press in pushbutton4. SHOW ALL
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
handles.output = hObject;
[status dlsoutput] = system ('bash ./dls -r 0')
%set(handles.outputbox,'String',[output dlsoutput]);
listelem =regexp(dlsoutput, '\n', 'split')
set(handles.listbox1,'String',listelem)
count=1
table = get(handles.dataset_table,'Data')
for ii=1:length(listelem)
    if (strfind(listelem{ii},'dataset'))
         sline = regexp(listelem{ii},'\s+','split')
         % Sort into proper columns
         table{count,1} = sline{4}; %Full CID
         table{count,2} = sline{9};
         table{count,3} = sline{8};
         table{count,4} = [sline{6} ' ' sline{7}];
         table{count,5} = sline{10};
        count=count+1
     end
end
set(handles.dataset_table,'Data',table)

% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton4.
function pushbutton4_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles.output = hObject;
[status dlsoutput] = system ('bash ./dls -r 0')
%set(handles.outputbox,'String',[output dlsoutput]);
listelem =regexp(dlsoutput, '\n', 'split')
set(handles.listbox1,'String',listelem)
count=0
table = get(handles.dataset_table,'Data')
for ii=1:length(listelems)
    if (strfind(listelems{ii},'dataset'))
       % regexp(listelem,'(587.2.1.[0-9]*.1.[0-9]*.[0-9]*)','match')
        sline = regexp(listelem{ii},'\s+','split');
        table{count,1} = sline{4};
        table{count,2} = sline{9};
        table{count,3} = sline{8};
        table{count,4} = [sline{6} ' ' sline{7}];
        table{count,5} = sline{10};
        count=count+1;
    end
end
set(handles.dataset_table,'Data',table)


% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
pushbutton4_ButtonDownFcn(hObject, eventdata, handles)

% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% Current Directory
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to CurrentDir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of CurrentDir as text
%        str2double(get(hObject,'String')) returns contents of CurrentDir as a double


% --- Executes during object creation, after setting all properties.
function pushbutton6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to CurrentDir (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton13 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton14 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton15 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on selection change in popupmenu4.
function popupmenu4_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu4 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu4


% --- Executes during object creation, after setting all properties.
function popupmenu4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on selection change in popupmenu5.
function popupmenu5_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu5 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu5


% --- Executes during object creation, after setting all properties.
function popupmenu5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function edit7_Callback(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double


% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)function uipanel1_ResizeFcn(hObject, eventdata, handles)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton16 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes when uipanel1 is resized.
function uipanel1_ResizeFcn(hObject, eventdata, handles)
% hObject    handle to uipanel1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in ShowImagepushbutton.
function ShowImagepushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to ShowImagepushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in ShowMaskpushbutton.
function ShowMaskpushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to ShowMaskpushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --- Executes on button press in ShowGlomspushbutton.
function ShowGlomspushbutton_Callback(hObject, eventdata, handles)
% hObject    handle to ShowGlomspushbutton (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
